package start.demo01.enum7_11;

public enum TrafficLight {
    RED(30){
        @Override
        public TrafficLight  nextLight(){
            return GREEN;
        }
    },
    GREEN(45){
        @Override
        public TrafficLight  nextLight(){
            return YELLOW;
        }
    },
    YELLOW(3){
        @Override
        public TrafficLight  nextLight(){
            return RED;
        }
    };
    private int time;
    private TrafficLight(int time){
        this.time=time;
    }
    public int getTime(){
        return time;
    }
    public abstract TrafficLight  nextLight();
}
